home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / lynx-2.4 / WWW / Library / Implementation / HTAccess.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-28  |  6.8 KB  |  300 lines

  1. /*                                                      HTAccess:  Access manager  for libwww
  2.                                       ACCESS MANAGER
  3.                                              
  4.    This module keeps a list of valid protocol (naming scheme) specifiers with associated
  5.    access code.  It allows documents to be loaded given various combinations of
  6.    parameters. New access protocols may be registered at any time.
  7.    
  8.    Part of the libwww library .
  9.    
  10.  */
  11. #ifndef HTACCESS_H
  12. #define HTACCESS_H
  13.  
  14. extern char * use_this_url_instead;
  15.  
  16. /*      Definition uses:
  17. */
  18. #ifndef HTUTILS_H
  19. #include "HTUtils.h"
  20. #endif /* HTUTILS_H */
  21. #include "tcp.h"
  22. #include "HTAnchor.h"
  23. #include "HTFormat.h"
  24.  
  25. #ifdef SHORT_NAMES
  26. #define HTClientHost            HTClHost
  27. #define HTSearchAbsolute        HTSeAbso
  28. #define HTOutputStream          HTOuStre
  29. #define HTOutputFormat          HTOuForm
  30. #endif
  31.  
  32. /*      Return codes from load routines:
  33. **
  34. **      These codes may be returned by the protocol modules,
  35. **      and by the HTLoad routines.
  36. **      In general, positive codes are OK and negative ones are bad.
  37. */
  38.  
  39. #define HT_NO_DATA -9999        /* return code: OK but no data was loaded */
  40.                                 /* Typically, other app started or forked */
  41.  
  42. /*
  43.  
  44. Default Addresses
  45.  
  46.    These control the home page selection. To mess with these for normal browses is asking
  47.    for user confusion.
  48.    
  49.  */
  50. #define LOGICAL_DEFAULT "WWW_HOME"  /* Defined to be the home page */
  51.  
  52. #ifndef PERSONAL_DEFAULT
  53. #define PERSONAL_DEFAULT "WWW/default.html"     /* in home directory */
  54. #endif
  55. #ifndef LOCAL_DEFAULT_FILE
  56. #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
  57. #endif
  58. /*  If one telnets to a www access point,
  59.     it will look in this file for home page */
  60. #ifndef REMOTE_POINTER
  61. #define REMOTE_POINTER  "/etc/www-remote.url"  /* can't be file */
  62. #endif
  63. /* and if that fails it will use this. */
  64. #ifndef REMOTE_ADDRESS
  65. #define REMOTE_ADDRESS  "http://www.w3.org/remote.html"  /* can't be file */
  66. #endif
  67.  
  68. /* If run from telnet daemon and no -l specified, use this file:
  69. */
  70. #ifndef DEFAULT_LOGFILE
  71. #define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
  72. #endif
  73.  
  74. /*      If the home page isn't found, use this file:
  75. */
  76. #ifndef LAST_RESORT
  77. #define LAST_RESORT     "http://www.w3.org/default.html"
  78. #endif
  79.  
  80.  
  81. /*
  82.  
  83. Flags which may be set to control this module
  84.  
  85.  */
  86. #ifdef NOT
  87. extern int HTDiag;                      /* Flag: load source as plain text */
  88. #endif /* NOT */
  89. extern char * HTClientHost;             /* Name or number of telnetting host */
  90. extern FILE * logfile;                  /* File to output one-liners to */
  91. extern BOOL HTSecure;                   /* Disable security holes? */
  92. extern HTStream* HTOutputStream;        /* For non-interactive, set this */
  93. extern HTFormat HTOutputFormat;         /* To convert on load, set this */
  94.  
  95.  
  96.  
  97. /*
  98.  
  99. Load a document from relative name
  100.  
  101.   ON ENTRY,
  102.   
  103.   relative_name           The relative address of the file to be accessed.
  104.                          
  105.   here                    The anchor of the object being searched
  106.                          
  107.   ON EXIT,
  108.   
  109.   returns    YES          Success in opening file
  110.                          
  111.   NO                      Failure
  112.                          
  113.  */
  114. extern  BOOL HTLoadRelative PARAMS((
  115.                 CONST char *            relative_name,
  116.                 HTParentAnchor *        here));
  117.  
  118.  
  119. /*
  120.  
  121. Load a document from absolute name
  122.  
  123.   ON ENTRY,
  124.   
  125.   addr                    The absolute address of the document to be accessed.
  126.                          
  127.   filter                  if YES, treat document as HTML
  128.                          
  129.  */
  130.  
  131. /*
  132.  
  133.   ON EXIT,
  134.   
  135.  */
  136.  
  137. /*
  138.  
  139.   returns YES             Success in opening document
  140.                          
  141.   NO                      Failure
  142.                          
  143.  */
  144. extern BOOL HTLoadAbsolute PARAMS((CONST DocAddress * addr));
  145.  
  146.  
  147. /*
  148.  
  149. Load a document from absolute name to a stream
  150.  
  151.   ON ENTRY,
  152.   
  153.   addr                    The absolute address of the document to be accessed.
  154.                          
  155.   filter                  if YES, treat document as HTML
  156.                          
  157.   ON EXIT,
  158.   
  159.   returns YES             Success in opening document
  160.                          
  161.   NO                      Failure
  162.                          
  163.    Note: This is equivalent to HTLoadDocument
  164.    
  165.  */
  166. extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
  167.                                 HTStream * sink));
  168.  
  169.  
  170. /*
  171.  
  172. Load if necessary, and select an anchor
  173.  
  174.   ON ENTRY,
  175.   
  176.   destination                The child or parenet anchor to be loaded.
  177.                          
  178.  */
  179.  
  180. /*
  181.  
  182.   ON EXIT,
  183.   
  184.  */
  185.  
  186. /*
  187.  
  188.   returns YES             Success
  189.                          
  190.   returns NO              Failure
  191.                          
  192.  */
  193.  
  194.  
  195.  
  196. extern BOOL HTLoadAnchor PARAMS((HTAnchor * destination));
  197.  
  198.  
  199. /*
  200.  
  201. Make a stream for Saving object back
  202.  
  203.   ON ENTRY,
  204.   
  205.   anchor                  is valid anchor which has previously beeing loaded
  206.                          
  207.   ON EXIT,
  208.   
  209.   returns                 0 if error else a stream to save the object to.
  210.                          
  211.  */
  212.  
  213.  
  214. extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
  215.  
  216.  
  217. /*
  218.  
  219. Search
  220.  
  221.    Performs a search on word given by the user. Adds the search words to the end of the
  222.    current address and attempts to open the new address.
  223.    
  224.   ON ENTRY,
  225.   
  226.   *keywords               space-separated keyword list or similar search list
  227.                          
  228.   here                    The anchor of the object being searched
  229.                          
  230.  */
  231. extern BOOL HTSearch PARAMS((CONST char * keywords, HTParentAnchor* here));
  232.  
  233.  
  234. /*
  235.  
  236. Search Given Indexname
  237.  
  238.    Performs a keyword search on word given by the user. Adds the keyword to  the end of
  239.    the current address and attempts to open the new address.
  240.    
  241.   ON ENTRY,
  242.   
  243.   *keywords               space-separated keyword list or similar search list
  244.                          
  245.   *indexname              is name of object search is to be done on.
  246.                          
  247.  */
  248. extern BOOL HTSearchAbsolute PARAMS((
  249.         CONST char *    keywords,
  250.         CONST char *    indexname));
  251.  
  252.  
  253. /*
  254.  
  255. Register an access method
  256.  
  257.  */
  258.  
  259. typedef struct _HTProtocol {
  260.         char * name;
  261.         
  262.         int (*load)PARAMS((
  263.                 CONST char *    full_address,
  264.                 HTParentAnchor * anchor,
  265.                 HTFormat        format_out,
  266.                 HTStream*       sink));
  267.                 
  268.         HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
  269.  
  270. } HTProtocol;
  271.  
  272. extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
  273.  
  274.  
  275. /*
  276.  
  277. Generate the anchor for the home page
  278.  
  279.  */
  280.  
  281. /*
  282.  
  283.    As it involves file access, this should only be done once when the program first runs.
  284.    This is a default algorithm -- browser don't HAVE to use this.
  285.    
  286.  */
  287. extern HTParentAnchor * HTHomeAnchor NOPARAMS;
  288.  
  289. /*
  290.  
  291. Return Host Name
  292.  
  293.  */
  294. extern CONST char * HTHostName NOPARAMS;
  295.  
  296. #endif /* HTACCESS_H */
  297. /*
  298.  
  299.    end of HTAccess  */
  300.